home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Interactive 7
/
PC World Interactive 7.iso
/
program
/
ctutord.EXE
/
83.C
< prev
next >
Wrap
C/C++ Source or Header
|
1990-09-17
|
828b
|
37 lines
/*
There may be additional include files required depending
upon the compile product you are using. Typical compilers
include Microsoft C by Microsoft or Turbo C by Boland Int'l.
*/
#include <stdio.h>
struct A {
int i,j,k;
};
struct B {
char a,b,c;
};
struct C {
struct A ijk;
struct B abc;
struct A *ptr;
};
main()
{
/* allocate space for structures */
struct A test; struct C example;
/* initialize test */
test.i=1; test.j=2; test.k=3;
/* initialize pointer to structure */
example.ptr = &test;
/* print out test.i, test.j, test.k using pointer */
printf("%d %d ",example.ptr->i, example.ptr->j);
printf("%d\n",example.ptr->k);
/* initialize structures ijk and abc with zeros */
example.ijk.i=example.ijk.j=example.ijk.k=0
example.abc.a=example.abc.b=example.abc.c=0
}